﻿using System;
using HiTeachers.Services;

namespace HiTeachers.Web
{
    public partial class verification : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var reqId = new Guid(Request["rqpid"]);
            var studentRequest = StudentRequestServices.GetById(reqId);

            if (studentRequest == null || studentRequest.PostedDate.AddDays(7) < DateTime.Now)
            {
                divError.Visible = true;
                divSuccess.Visible = false;
                return;
            }

            studentRequest.IsVerified = true;
            StudentRequestServices.SaveOrUpdate(studentRequest);
            divError.Visible = false;
            divSuccess.Visible = true;
        }
    }
}
